Learning Objectives

After completing this course, you'll be able to:

Introduction

Let's just put attributes to one side for a moment and look at transformer parameters.

Transformer parameters are often set in a fixed way (hard-coded) or set to take on the value of a particular attribute. However, just as you can construct attributes using the Text or Arithmetic Editor, you can build values for transformer parameters.

Using Attributes for Parameters

As noted, most transformer parameters allow the user to select an attribute value instead of manually entering a fixed value. For example, the LabelPointReplacer can create a label whose contents and height are specified by attribute values:

The parameters of the LabelPointReplacer

This feature is helpful because it allows the parameters (for example, label size) to get a different value for each feature. An attribute could be read from a source dataset or calculated using an ExpressionEvaluator so that one feature creates a label ten units in height, another creates a label 15 units high, and so on. It is no longer a fixed value.

Constructing Parameter Values

If a parameter value needs to be calculated or constructed, instead of using a separate transformer, FME has integrated string and numeric editors built into parameter dialogs.

For example, here, the user is choosing to calculate label height using an arithmetic calculator:

Using the Arithmetic Editor so set Label Height

The calculator allows the selection and use of FME attributes, other parameters, and mathematical and string-based functions. For example, here, the user has chosen to calculate the height of their labels using the logarithm of the visitor count for a park:

Setting Label Height to use a mathematical expression

Note

It's a fixed rule that the editor dialogs available depend upon the type of parameter being set. For instance, the Label parameter in a LabelPointReplacer opens a text editor because the parameter requires a text value. The Label Height parameter opens an arithmetic editor because that parameter requires a numeric value.

Reducing Workspace Congestion

Like when attribute values are constructed, workspaces are more compact when as many peripheral operations as possible are directly integrated into a single transformer or parameter. However, as with attributes, it's important to add proper annotation, or else it's difficult for a casual observer to understand what the workspace is meant to do.

Another drawback specific to parameters, is that constructing them in situ means you don't get the information as an attribute to use elsewhere. For example, if you construct a label string in the LabelPointReplacer, that string isn't available as an attribute elsewhere in the workspace.

If you need to use this constructed value in more than one place, then it is essential to create it as an attribute.